class Solution:
    def maxArea(self, height: list[int]) -> int:
        left,right=0,len(height)-1
        max_size=(right-left)*(min(height[left],height[right]))
        while left<right:
            middle=(right-left)*(min(height[left],height[right]))
            max_size=max(max_size,middle)
            if height[left]<height[right]:
                left+=1
            else:
                right-=1
        return max_size